package org.neuedu.servlet;

import org.neuedu.bean.Article;
import org.neuedu.bean.Detail;
import org.neuedu.service.ArticleService;
import org.neuedu.service.ArticleServiceImpl;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

@WebServlet(name = "ForwardmessageServlet",urlPatterns = "/forward/message")
public class ForwardmessageServlet extends HttpServlet {
    protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {

    }

    protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        //根据uid查询文章评论，文章title
        String uid = request.getParameter("uid");
        ArticleService service = new ArticleServiceImpl();
        Article articleDetailByUid = service.getArticleDetailByUid(Integer.valueOf(uid));

        request.setAttribute("detailInfo",articleDetailByUid);
        request.getRequestDispatcher("/WEB-INF/jsp/user/message.jsp").forward(request,response);
    }
}
